package com.example;

import com.example.lifecycle.BeanLifeComponent;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @ClassName MainLifeCycle
 * @Description TODO
 * @Author H.
 * @Date 2023/5/8 16:41
 * @Version 1.0
 */

public class MainLifeCycle {
    public static void main(String[] args) {
        ClassPathXmlApplicationContext context =
                new ClassPathXmlApplicationContext("spring-config.xml");
        BeanLifeComponent life = context.getBean(BeanLifeComponent.class);

        System.out.println("执行 main 方法");

// 执行销毁方法
        context.destroy();
    }
}
